/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pabudr_se;

import java.awt.geom.Line2D;
import java.io.Serializable;


public class Barrier extends Line2D.Float implements Serializable {


    final float nx;
    final float ny;
    final Vector2 normale;
    final Vector2 richtung;
    final float nn;
    final float rr;
    final float length;
    final Vector2[] StartEnd = new Vector2[2];

    public Barrier(float x1, float y1, float x2, float y2) {
        super(x1, y1, x2, y2);
        StartEnd[0] = new Vector2(x1, y1);
        StartEnd[1] = new Vector2(x2, y2);
        richtung = StartEnd[1].sub(StartEnd[0]);
        rr = richtung.mul(richtung);
        
        final float dx = x1 - x2;
        final float dy = y1 - y2;
        length = (float)Math.sqrt(dx*dx + dy*dy);

        nx = dy / length;
        ny = - dx / length;

        normale = new Vector2(nx, ny);
        nn = normale.mul(normale);

    }

}
